\(\int \frac {a+b x^2}{1-x^2} \, dx\) [108]

   Optimal result
   Rubi [A] (verified)
   Mathematica [B] (verified)
   Maple [C] (verified)
   Fricas [B] (verification not implemented)
   Sympy [B] (verification not implemented)
   Maxima [B] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 17, antiderivative size = 11 \[ \int \frac {a+b x^2}{1-x^2} \, dx=-b x+(a+b) \text {arctanh}(x) \]

[Out]

-b*x+(a+b)*arctanh(x)

Rubi [A] (verified)

Time = 0.01 (sec) , antiderivative size = 11, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.118, Rules used = {396, 212} \[ \int \frac {a+b x^2}{1-x^2} \, dx=(a+b) \text {arctanh}(x)-b x \]

[In]

Int[(a + b*x^2)/(1 - x^2),x]

[Out]

-(b*x) + (a + b)*ArcTanh[x]

Rule 212

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))*ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x]
 /; FreeQ[{a, b}, x] && NegQ[a/b] && (GtQ[a, 0] || LtQ[b, 0])

Rule 396

Int[((a_) + (b_.)*(x_)^(n_))^(p_)*((c_) + (d_.)*(x_)^(n_)), x_Symbol] :> Simp[d*x*((a + b*x^n)^(p + 1)/(b*(n*(
p + 1) + 1))), x] - Dist[(a*d - b*c*(n*(p + 1) + 1))/(b*(n*(p + 1) + 1)), Int[(a + b*x^n)^p, x], x] /; FreeQ[{
a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && NeQ[n*(p + 1) + 1, 0]

Rubi steps \begin{align*} \text {integral}& = -b x-(-a-b) \int \frac {1}{1-x^2} \, dx \\ & = -b x+(a+b) \tanh ^{-1}(x) \\ \end{align*}

Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(28\) vs. \(2(11)=22\).

Time = 0.01 (sec) , antiderivative size = 28, normalized size of antiderivative = 2.55 \[ \int \frac {a+b x^2}{1-x^2} \, dx=\frac {1}{2} (-2 b x-(a+b) \log (1-x)+(a+b) \log (1+x)) \]

[In]

Integrate[(a + b*x^2)/(1 - x^2),x]

[Out]

(-2*b*x - (a + b)*Log[1 - x] + (a + b)*Log[1 + x])/2

Maple [C] (verified)

Result contains complex when optimal does not.

Time = 2.54 (sec) , antiderivative size = 20, normalized size of antiderivative = 1.82

method result size
meijerg \(\frac {i b \left (2 i x -2 i \operatorname {arctanh}\left (x \right )\right )}{2}+a \,\operatorname {arctanh}\left (x \right )\) \(20\)
norman \(-b x +\left (-\frac {a}{2}-\frac {b}{2}\right ) \ln \left (-1+x \right )+\left (\frac {a}{2}+\frac {b}{2}\right ) \ln \left (1+x \right )\) \(30\)
default \(-b x +\frac {\left (-a -b \right ) \ln \left (-1+x \right )}{2}-\frac {\left (-a -b \right ) \ln \left (1+x \right )}{2}\) \(32\)
risch \(-b x -\frac {\ln \left (-1+x \right ) a}{2}-\frac {\ln \left (-1+x \right ) b}{2}+\frac {\ln \left (1+x \right ) a}{2}+\frac {\ln \left (1+x \right ) b}{2}\) \(34\)
parallelrisch \(-b x -\frac {\ln \left (-1+x \right ) a}{2}-\frac {\ln \left (-1+x \right ) b}{2}+\frac {\ln \left (1+x \right ) a}{2}+\frac {\ln \left (1+x \right ) b}{2}\) \(34\)

[In]

int((b*x^2+a)/(-x^2+1),x,method=_RETURNVERBOSE)

[Out]

1/2*I*b*(2*I*x-2*I*arctanh(x))+a*arctanh(x)

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 23 vs. \(2 (11) = 22\).

Time = 0.25 (sec) , antiderivative size = 23, normalized size of antiderivative = 2.09 \[ \int \frac {a+b x^2}{1-x^2} \, dx=-b x + \frac {1}{2} \, {\left (a + b\right )} \log \left (x + 1\right ) - \frac {1}{2} \, {\left (a + b\right )} \log \left (x - 1\right ) \]

[In]

integrate((b*x^2+a)/(-x^2+1),x, algorithm="fricas")

[Out]

-b*x + 1/2*(a + b)*log(x + 1) - 1/2*(a + b)*log(x - 1)

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 22 vs. \(2 (8) = 16\).

Time = 0.09 (sec) , antiderivative size = 22, normalized size of antiderivative = 2.00 \[ \int \frac {a+b x^2}{1-x^2} \, dx=- b x - \frac {\left (a + b\right ) \log {\left (x - 1 \right )}}{2} + \frac {\left (a + b\right ) \log {\left (x + 1 \right )}}{2} \]

[In]

integrate((b*x**2+a)/(-x**2+1),x)

[Out]

-b*x - (a + b)*log(x - 1)/2 + (a + b)*log(x + 1)/2

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 23 vs. \(2 (11) = 22\).

Time = 0.20 (sec) , antiderivative size = 23, normalized size of antiderivative = 2.09 \[ \int \frac {a+b x^2}{1-x^2} \, dx=-b x + \frac {1}{2} \, {\left (a + b\right )} \log \left (x + 1\right ) - \frac {1}{2} \, {\left (a + b\right )} \log \left (x - 1\right ) \]

[In]

integrate((b*x^2+a)/(-x^2+1),x, algorithm="maxima")

[Out]

-b*x + 1/2*(a + b)*log(x + 1) - 1/2*(a + b)*log(x - 1)

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 25 vs. \(2 (11) = 22\).

Time = 0.27 (sec) , antiderivative size = 25, normalized size of antiderivative = 2.27 \[ \int \frac {a+b x^2}{1-x^2} \, dx=-b x + \frac {1}{2} \, {\left (a + b\right )} \log \left ({\left | x + 1 \right |}\right ) - \frac {1}{2} \, {\left (a + b\right )} \log \left ({\left | x - 1 \right |}\right ) \]

[In]

integrate((b*x^2+a)/(-x^2+1),x, algorithm="giac")

[Out]

-b*x + 1/2*(a + b)*log(abs(x + 1)) - 1/2*(a + b)*log(abs(x - 1))

Mupad [B] (verification not implemented)

Time = 5.16 (sec) , antiderivative size = 11, normalized size of antiderivative = 1.00 \[ \int \frac {a+b x^2}{1-x^2} \, dx=\mathrm {atanh}\left (x\right )\,\left (a+b\right )-b\,x \]

[In]

int(-(a + b*x^2)/(x^2 - 1),x)

[Out]

atanh(x)*(a + b) - b*x